//
//  订单提交Ctr.swift
//  Aiwei
//
//  Created by zhu xietong on 2017/11/8.
//  Copyright © 2017年 zhu xietong. All rights reserved.
//

import Foundation
import Eelay
import soapp

class Extra{
    class TitleCell:JoTableCell{
        let titleL = UILabel()
        override func addLayoutRules() {
            contentView.eelay = [
                [titleL,[ee.T.L.B.R,[20,AppTheme.edge,-10,-AppTheme.edge]]]
            ]
            titleL.ui.font14.color(color: ._foreground)

        }
        override func mo_model_reload() {
            titleL.text = mo.model["title",""]
        }
        
    }
    class InputCell:SimpleTextCell{
        override open func addLayoutRules() {
//            super.addLayoutRules()
    //        let w = Int(FieldCell.name_width) + 20
            
            titleL.ui.font15.cl_444.node("title")
            titleL.font = FieldView.valueStyle.font
            titleL.textColor = FieldView.valueStyle.color
            
            backgroundColor = ._cellBackground

            let t = Int(FieldCell.padding_top)
            let b = Int(FieldCell.padding_bottom)
            
            let l = Int(FieldCell.padding_left)
            //        let r = Int(FieldCell.padding_right)
            
            contentView.eelay = [
                [titleL,[ee.T.L.B,[8,l,-8]],"21",.<140],
                [requiredMark,[titleL,ee.Y,3],[titleL,ee.R,ee.L,2]],
            ]
            self.indicator = .none
            
            __line.backgroundColor = ._separator
            titleL.setContentConstrainToHighLever()
            requiredMark.ui.font18.text("*").text(color: .clear)
            rightIcon.ui.font(size: 13).ncolor(hex: "#aaa")
            contentView.eelay = [
                [titleL,140+1000],
                [textV,[ee.T.B,[0,0]],[titleL,ee.R,ee.L,8],[ee.R,-AppTheme.edge]],
            ]
            titleL.ui.bfont12.color(color: .systemBlue)
            textV.valueT.textAlignment = .left
        }
        
        open override func mo_model_reload() {
            textV.controller = self.content_controller
            titleL.text = mo.model["title",""]

            if let f = DataNode<NSMutableDictionary>.path(node: "\(FK.field)", mo.model)
            {
                textV.mo.model = f
            }
            else
            {
                if let f = DataNode<NSMutableDictionary>.path(node: "\(FK.fields).0", mo.model)
                {
                    textV.mo.model = f
                }
            }
//            textV.valueT.text = mo.model[FK.value,""]
            textV.valueT.ui.font(font:.systemFont(ofSize: 12))
            textV.valueT.attributedPlaceholder = textV.place_holder.ui.font12.color(color: UIColor.color(light: "#aaa", dark: "666")).astring
            titleL.textColor = .systemBlue

        }
        
        
    }
    
}
